<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="浏览主题" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link rel="stylesheet" href="/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="/kindeditor/lang/zh_CN.js"></script>
<script language="javascript">
	function doGo(pageIndex){
		window.location="/bbs/BbsReplyList.ihtm?column_id=${column.id}&topic_id=${topicId}&current_page="+pageIndex;
	}
	function doJump(pageIndex){
		if(window.event.keyCode==13){
			doGo(pageIndex);
		}
	}
	function goBack(){
		window.history.back(-1);
	}
	function doReply(){
		editor.sync();
		if(editor.isEmpty()) {
			parent.ShowAlert('提示框','请输入内容!',200,100);
			return false;
		}else{
			editorForm.submit();
		}
	}
	function doDelete(id){
		<c:if test="${currentUser.user.userType==1}">
			parent.ShowConfirm('确认框','确定删除吗？',340,80,"doDelRep("+id+")");//doDelRep是父窗口的
		</c:if>
		<c:if test="${currentUser.user.userType!=1}">
			parent.ShowAlert('提示框','对不起，只有系统管理员admin才能删除！',200,100);
		</c:if>
	}
	function doInit(){
	
	}
	var editor;
	KindEditor.ready(function(K) {
    	editor = K.create('textarea[name="content"]', {
    			resizeType : 1,
				allowImageUpload : false,
				items : [
						'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', 'indent', 'outdent','subscript', 'superscript', '|', 'emoticons', 'image', 'link', 'table', 'hr']
			});
    });
</script>
</head>
<body onLoad="doInit();" scroll="no" style="background: #EAFAFF;">
		<div id="scrollDiv" style="OVERFLOW:auto;height:468px;">
			<div class="main search-business">
			   <div class="cue-info">
					<h4>
						<a href="/bbs/BbsTopicList.ihtm?column_id=${column.id}">${column.columnName}</a>
						&gt;&gt;浏览主题
					</h4>				   	
				 </div>
				 <%@include file="../inc/AlertMsg.jsp"%>
				 
				 <c:if test="${fn:length(qr.list)==0}">
				 <table width="100%" border="0" cellpadding="1" cellspacing="1">
				 	<tr>
						<td align="center">
							<table border="0" cellpadding="0" cellspacing="0" class="table-list" style="width:98%">
								<tr>
									<td>该主题已删除</td>
								</tr>
							</table>
						</td>
					</tr>
				 </table>
				 </c:if>
				 
				 <c:if test="${fn:length(qr.list)>0}">
				 <table width="100%" border="0" cellpadding="1" cellspacing="1">
					<tr>
						<td align="center" style="padding:10px;">
							<table border="0" cellpadding="0" cellspacing="0" class="table-list" style="width:100%">
								<c:forEach var="item" items="${qr.list}" varStatus="i">
								<c:if test="${item.id==topicId}">
								<tr>
									<th>
										<h4>
										<div align="left">${item.title}</div>
										</h4>				   	
									</th>
								</tr>
								</c:if>
								<tr>
									<td style="text-align:left;background:#fcfcfc;">
										${item.createrName}
										<fmt:formatDate value="${item.createTime}" pattern="yyyy-MM-dd HH:mm"/>
										${(qr.pageIndex-1)*qr.pageSize+i.index+1}楼
										<a href="javascript:doDelete(${item.id});">删除</a>
									</td>
								</tr>
								<tr>
									<td>
										<div align="left" style="line-height:200%;">
											<c:if test="${item.enabled=='Y'}">
												${item.content}
												<c:if test="${item.parentId==0 && fn:length(accList)>0}">
													<br>附件：<br>
													<c:forEach var="attItem" items="${accList}">
														<img src="/images/a32.gif" border="0">
														<a href="<c:out value="${attItem.fileName}" />" target="_blank"><c:out value="${attItem.sourceName}" /></a>
														<br>
													</c:forEach>
												</c:if>
											</c:if>
											<c:if test="${item.enabled=='N'}">
												该内容已删除
											</c:if>
										</div>
									</td>
								</tr>
								</c:forEach>
								
								<tr>
								  	<td><div align="left"><%@include file="../inc/Pages.jsp"%></div></td>
								</tr>
								
							</table>
						</td>
					</tr>
					<tr>
						<td align="center" style="padding:10px;">
							<form name="editorForm" method="post" action="/bbs/BbsArticleReply.ihtm">
							<table width="100%" border="0" cellpadding="1" cellspacing="1" align="center">
								<tr>
									<td align="left"><textarea name="content" id="content" style="width:716px;height:160px;visibility:hidden;"></textarea></td>
								</tr>
							</table>
							<div class="modal-buttom">
								<input type="button" class="buttom-a" value=" 回 复 " onClick="doReply();">
								<input type="button" class="buttom-a" value=" 返 回 " onClick="goBack();">
								<input type="hidden" id="column_id" name="column_id" value="${column.id}">
								<input type="hidden" id="parent_id" name="parent_id" value="${topicId}">
							</div>
							</form>
						</td>
					</tr>
				</table>
				</c:if>
				
			</div>
		</div>
	</div>
</body>
</html>